<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>我的挂号详情 - 医院挂号系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="css/bootstrap.min.css">

    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/bootstrap.min.js"></script>
    <script src="js/jq-paginator.js"></script>

    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Arial', sans-serif;
        }


        body {
            background: linear-gradient(135deg, #f4f4f9 0%, #e4e4f3 100%);
            height: 100vh;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            position: relative;
            overflow: hidden;
        }



        .nav {
            width: 100%;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px 50px;
            background-color: #ffffff;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            position: fixed;
            top: 0;
            z-index: 10;
        }



        .nav img {
            height: 40px;
        }



        .container-login {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin-top: 70px;
        }

        .login-dialog {
            background-color: #ffffff;
            width: 400px;
            padding: 40px;
            border-radius: 10px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        }

        .login-dialog h3 {
            text-align: center;
            margin-bottom: 30px;
            color: #3498db;
            font-size: 28px;
            font-weight: bold;
        }

        .row {
            margin-bottom: 20px;
            position: relative;
        }

        .row span {
            display: block;
            margin-bottom: 8px;
            color: #555;
            font-size: 14px;
        }

        .row input {
            width: 100%;
            padding: 12px 15px;
            border: 1px solid #ddd;
            border-radius: 5px;
            font-size: 16px;
            outline: none;
            transition: border-color 0.3s;
        }

        .row input:focus {
            border-color: #3498db;
        }

        .input-icon {
            position: absolute;
            top: 10px;
            right: 15px;
            color: #aaa;
            font-size: 18px;
        }

        #togglePassword {
            cursor: pointer;
        }

        #confirm {
            display: flex;
            align-items: center;
        }

        #confirm input {
            width: 60%;
            margin-right: 10px;
        }

        #verificationCodeImg {
            width: 100px;
            height: 40px;
            margin: 0;
        }

        .captcha-hint {
            font-size: 12px;
            color: #888;
            margin-top: 5px;
            text-align: center;
        }

        #submit {
            width: 100%;
            padding: 12px;
            background-color: #3498db;
            color: white;
            border: none;
            border-radius: 5px;
            font-size: 16px;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        #submit:hover {
            background-color: #2980b9;
        }

        .register-button {
            width: 100%;
            padding: 12px;
            background-color: #f8f9fa;
            color: #3498db;
            border: 1px solid #3498db;
            border-radius: 5px;
            font-size: 16px;
            cursor: pointer;
            transition: all 0.3s;
            text-align: center;
        }

        .register-button:hover {
            background-color: #eef5fc;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .nav {
                padding: 15px 20px;
            }

            .login-dialog {
                width: 90%;
                padding: 30px 20px;
            }
        }

        .error-row .error-message {
            display: block;
        }
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background: linear-gradient(135deg, #e8f4ff 0%, #d1e9ff 100%);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
            position: relative;
            overflow-x: hidden;
        }

        /* 医疗背景元素 */
        .ecg-line {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 120px;
            background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120" preserveAspectRatio="none"><path d="M0,0V46.29c47.79,22.2,103.59,32.17,158,28,70.36-5.37,136.33-33.31,206.8-37.5C438.64,32.43,512.34,53.67,583,72.05c69.27,18,138.3,24.88,209.4,13.08,36.15-6,69.85-17.84,104.45-29.34C989.49,25,1113-14.29,1200,52.47V0Z" opacity=".25" fill="%230d6efd"></path><path d="M0,0V15.81C13,36.92,27.64,56.86,47.69,72.05,99.41,111.27,165,111,224.58,91.58c31.15-10.15,60.09-26.07,89.67-39.8,40.92-19,84.73-46,130.83-49.67,36.26-2.85,70.9,9.42,98.6,31.56,31.77,25.39,62.32,62,103.63,73,40.44,10.79,81.35-6.69,119.13-24.28s75.16-39,116.92-43.05c59.73-5.85,113.28,22.88,168.9,38.84,30.2,8.66,59,6.17,87.09-7.5,22.43-10.89,48-26.93,60.65-49.24V0Z" opacity=".5" fill="%230d6efd"></path><path d="M0,0V5.63C149.93,59,314.09,71.32,475.83,42.57c43-7.64,84.23-20.12,127.61-26.46,59-8.63,112.48,12.24,165.56,35.4C827.93,77.22,886,95.24,951.2,90c86.53-7,172.46-45.71,248.8-84.81V0Z" fill="%230d6efd"></path></svg>');
            background-size: cover;
            z-index: -1;
        }

        .medical-icons {
            position: absolute;
            top: 50px;
            right: 50px;
            opacity: 0.05;
            z-index: -1;
        }

        .medical-icons i {
            font-size: 8rem;
            color: #0d6efd;
            display: block;
            margin-bottom: 20px;
        }

        /* 导航栏样式 */
        .nav {
            width: 100%;
            display: flex;
            align-items: center;
            padding: 15px 50px;
            background: white;
            box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
            position: relative;
            z-index: 10;
        }

        .nav-logo {
            height: 50px;
            width: 50px;
            border-radius: 50%;
            background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 24px;
            font-weight: bold;
            margin-right: 15px;
            box-shadow: 0 3px 10px rgba(13, 110, 253, 0.3);
        }

        .nav-title {
            color: #0d6efd;
            font-size: 1.5rem;
            font-weight: 700;
            letter-spacing: 0.5px;
        }

        .nav-links {
            display: flex;
            align-items: center;
            margin-left: auto;
            gap: 15px;
        }

        .nav-link-custom {
            display: flex;
            align-items: center;
            padding: 8px 16px;
            color: #555;
            text-decoration: none;
            font-weight: 500;
            border-radius: 6px;
            transition: all 0.3s ease;
        }

        .nav-link-custom i {
            margin-right: 6px;
            font-size: 1rem;
            transition: transform 0.3s ease;
        }

        .nav-link-custom:hover {
            background: rgba(13, 110, 253, 0.08);
            color: #0d6efd;
        }

        .nav-link-custom:hover i {
            transform: scale(1.1);
        }

        .user-dropdown {
            position: relative;
            margin-left: 10px;
        }

        .user-info {
            display: flex;
            align-items: center;
            padding: 8px 16px;
            color: #555;
            cursor: pointer;
            border-radius: 6px;
            transition: all 0.3s ease;
        }

        .user-info:hover {
            background: rgba(13, 110, 253, 0.08);
            color: #0d6efd;
        }

        .user-info i {
            margin-right: 8px;
            font-size: 1.2rem;
        }

        .user-dropdown-menu {
            position: absolute;
            top: 100%;
            right: 0;
            width: 200px;
            background: white;
            border-radius: 8px;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
            padding: 10px 0;
            margin-top: 5px;
            opacity: 0;
            visibility: hidden;
            transform: translateY(10px);
            transition: all 0.3s ease;
            z-index: 1000;
        }

        .user-dropdown:hover .user-dropdown-menu {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }

        .user-dropdown-menu::before {
            content: '';
            position: absolute;
            top: -8px;
            right: 20px;
            width: 16px;
            height: 16px;
            background: white;
            transform: rotate(45deg);
        }

        .user-dropdown-item {
            display: flex;
            align-items: center;
            padding: 10px 20px;
            color: #333;
            text-decoration: none;
            font-weight: 500;
            transition: all 0.2s ease;
        }

        .user-dropdown-item i {
            margin-right: 10px;
            color: #0d6efd;
            font-size: 1rem;
        }

        .user-dropdown-item:hover {
            background: #f0f7ff;
            color: #0d6efd;
        }



        .card-header h2 {
            font-size: 2rem;
            font-weight: 700;
            margin-bottom: 5px;
        }

        .card-header p {
            opacity: 0.9;
            font-size: 1rem;
        }



        .form-label i {
            margin-right: 8px;
            color: #0d6efd;
            font-size: 1.1rem;
        }



        .input-icon {
            position: absolute;
            left: 15px;
            bottom: 14px;
            color: #777;
            font-size: 1.2rem;
        }




        .captcha-hint {
            font-size: 0.85rem;
            color: #777;
            margin-top: 5px;
            text-align: center;
        }



        .register-link a {
            color: #0d6efd;
            text-decoration: none;
            font-weight: 500;
            transition: all 0.3s ease;
        }

        .register-link a:hover {
            text-decoration: underline;
        }

        /* 动画效果 */
        @keyframes float {
            0% { transform: translateY(0px); }
            50% { transform: translateY(-10px); }
            100% { transform: translateY(0px); }
        }

        .floating {
            animation: float 4s ease-in-out infinite;
        }

    </style>
</head>
<body>

<!-- 背景装饰 -->
<div class="ecg-line"></div>
<div class="medical-icons floating">
    <i class="bi bi-heart-pulse"></i>
    <i class="bi bi-hospital"></i>
    <i class="bi bi-capsule"></i>
</div>

<!-- 导航栏 -->
<nav class="nav">
    <div class="nav-logo">
        <img src="pic/logo2.jpg" class="nav-logo" alt="医院系统Logo">
    </div>
    <span class="nav-title">医院挂号系统</span>

    <div class="nav-links">
        <a class="nav-link-custom" onclick="pl()">
            <i class="bi bi-house-door"></i>主页
        </a>
<!--        <a class="nav-link-custom" onclick="pl()">
            <i class="bi bi-calendar-plus"></i>快速挂号
        </a>-->

        <div class="user-dropdown">
            <div class="user-info">
                <i class="bi bi-person-circle"></i>
                <span>当前用户</span>
            </div>

            <div class="user-dropdown-menu">
<!--                <a class="user-dropdown-item" onclick="pl()">-->
<!--                    <i class="bi bi-person-badge"></i>个人资料-->
<!--                </a>-->
                <a class="user-dropdown-item" onclick="pl()">
                    <i class="bi bi-calendar-check"></i>我的挂号详情
                </a>
                <a class="user-dropdown-item" onclick="pl()">
                    <i class="bi bi-box-arrow-right"></i>退出登录
                </a>
            </div>
        </div>
    </div>
</nav>



<div class="container-login">
    <div class="login-dialog">
        <h3>用户登录</h3>
        <div class="row">
            <span><i class="fas fa-user"></i> 用户名</span>
            <input type="text" name="username" id="username" placeholder="请输入用户名">

        </div>
        <div class="row">
            <span><i class="fas fa-lock"></i> 密码</span>
            <input type="password" name="password" id="password" placeholder="请输入密码">

        </div>

        <div class="row">
            <span><i class="fas fa-shield-alt"></i> 验证码</span>
            <div id="confirm">
                <input type="text" name="inputCaptcha" id="inputCaptcha" placeholder="请输入验证码">
                <img id="verificationCodeImg" src="/Captcha/get" style="cursor: pointer;" title="看不清？换一张" />
            </div>
            <div class="captcha-hint">点击图片刷新验证码</div>
        </div>


        <div class="row">
            <button id="submit" onclick="login()">提交</button>
        </div>

        <div class="row">
            <a href="register.html">
                <button type="button" class="register-button">注册新账号</button>
            </a>
        </div>
    </div>
</div>




<script src="js/jquery.min.js"></script>
<script>

    $("#verificationCodeImg").click(function(){
        $(this).hide().attr('src', '/Captcha/get?dt=' + Date.now()).fadeIn();
    });


    function pl(){
        alert("请先登录")
    }

    function login() {
        // 获取输入值
        const captchaVal = $("#inputCaptcha").val().trim();
        const usernameVal = $("#username").val().trim();
        const passwordVal = $("#password").val();

        // 前端验证
        if (!usernameVal) {
            alert("用户名不能为空");
            return;
        }
        if (!passwordVal) {
            alert("密码不能为空");
            return;
        }
        if (!captchaVal) {
            alert("验证码不能为空");
            return;
        }

        // 验证码检查
        $.ajax({
            type: "POST",
            url: "/Captcha/check",
            data: { inCode: captchaVal },
            success: function(captchaResponse) {
                // 重命名变量避免冲突
                if (captchaResponse  === "输入为空") {
                    alert("验证码不能为空");
                    refreshCaptcha();
                    return;
                }

                if (captchaResponse  === "验证码正确") {
                    // 验证通过后执行登录
                    $.ajax({
                        type: "POST",
                        url: "/user/login",
                        data: {
                            username: usernameVal,
                            password: passwordVal
                        },
                        success: function(loginResponse) {
                            // 使用不同变量名
                            if (loginResponse!=null) {
                                location.href = 'home.html?userId='+loginResponse.userId;
                            } else {
                                alert(loginResponse.msg || "登录失败");
                                refreshCaptcha();
                            }
                        },
                        error: function(xhr) {
                            console.error("登录请求失败", xhr);
                            alert("登录服务异常 " );
                            refreshCaptcha();
                        }
                    });
                } else {
                    alert(captchaResponse.message || "验证码错误");
                    refreshCaptcha();
                }
            },
            error: function(error) {
                console.error("验证码请求失败", error);
                alert("验证码服务异常");
                refreshCaptcha();
            }
        });
    }

    // 刷新验证码函数
    function refreshCaptcha() {
        $("#verificationCodeImg")
            .hide()
            .attr('src', '/Captcha/get?dt=' + Date.now())
            .fadeIn();
        $("#inputCaptcha").val('').focus();
    }


</script>
</body>

</html>